﻿using System.Data;
using System.Data.SqlClient;
namespace MyWeb.Data
{
	public class tblROLESDAL : SqlDataProvider
	{

		#region[tblROLES_GetbyAll]
		public DataTable tblROLES_GetByAll()
		{
			using (var cmd = new SqlCommand("sp_tblROLES_GetByAll", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				return GetTable(cmd);
			}
		}
		#endregion
		#region[tblROLES_GetbyId]
		public DataTable tblROLES_GetById(string ROLEID)
		{
			using (var cmd = new SqlCommand("sp_tblROLES_GetById", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@ROLEID", ROLEID));return GetTable(cmd);
			}
		}
		#endregion
		#region[tblROLES_GetbyTop]
		public DataTable tblROLES_GetByTop(string Top, string Where, string Order)
		{
			using (var cmd = new SqlCommand("sp_tblROLES_GetByTop", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				var da = new SqlDataAdapter(cmd);
				cmd.Parameters.Add(new SqlParameter("@Top",Top));
				cmd.Parameters.Add(new SqlParameter("@Where",Where));
				cmd.Parameters.Add(new SqlParameter("@Order",Order));
				return GetTable(cmd);
			}
		}
		#endregion
		#region[tblROLES_Insert]
		public void tblROLES_Insert(tblROLESInfo Data)
		{
			using (var cmd = new SqlCommand("sp_tblROLES_Insert", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@ROLENAME", Data.ROLENAME));
				ExeCuteNonquery(cmd);
			}
		}
		#endregion
		#region[tblROLES_Update]
		public void tblROLES_Update(tblROLESInfo Data)
		{
			using (var cmd = new SqlCommand("sp_tblROLES_Update", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@ROLEID", Data.ROLEID));
				cmd.Parameters.Add(new SqlParameter("@ROLENAME", Data.ROLENAME));
				ExeCuteNonquery(cmd);
			}
		}
		#endregion
		#region[tblROLES_Delete]
		public void tblROLES_Delete(string ROLEID)
		{
			using (var cmd = new SqlCommand("sp_tblROLES_Delete", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@ROLEID",ROLEID));
				ExeCuteNonquery(cmd);
			}
		}
		#endregion
	}
}